﻿/*
 * MPU6050.h
 *
 *  Created on: Aug 25, 2024
 *      Author: Jie
 */

#ifndef INC_MPU6050_H_
#define INC_MPU6050_H_

#define ERROR_MPU_INIT      -1
#define ERROR_SET_SENSOR    -2
#define ERROR_CONFIG_FIFO   -3
#define ERROR_SET_RATE      -4
#define ERROR_LOAD_MOTION_DRIVER    -5
#define ERROR_SET_ORIENTATION       -6
#define ERROR_ENABLE_FEATURE        -7
#define ERROR_SET_FIFO_RATE         -8
#define ERROR_SELF_TEST             -9
#define ERROR_DMP_STATE             -10

#define DEFAULT_MPU_HZ  100
#define Q30  1073741824.0f
#include <stdint.h>

typedef struct mpu6050_Obj mpu6050_Obj;

struct mpu6050_Obj
{
    float pitch, roll, yaw;          // 姿态角
    float accel_x, accel_y, accel_z; // 加速度
    float gyro_x, gyro_y, gyro_z;    // 角速度
    uint8_t initialized;

    uint8_t data_flag; // 数据更新

    void ( *run )( void );
};

mpu6050_Obj* create_MPU6050_Obj( void );


#endif /* INC_MPU6050_H_ */
